package cj.web.lkg.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

@DAO
public interface ConfigDAO {
	//byCode查询
	@SQL("select id,parentId,code,name,value,orderNo,updateAt,descs from ConfigInfo where code=:1")
	List<Map> queryById(String code);
	//查询所以栏目
	@SQL("select id,type,subType,name,descs from Columns where type=0 and deleteFlag=1 ORDER BY orderNo,id ")
	List<Map> queryColumnsAll();
	//查询默认的栏目列表
	@SQL("select id,type,subType,name,descs from Columns where type=0 and subType=0 and deleteFlag=1 ORDER BY orderNo,id ")
	List<Map> queryColumnsPtlmAll();
	//查询开机画面
	@SQL("select id,title,carouselImage,releaseState,releaseAt,isOuterLink from ActionAdvertisement where releaseState=1 and deleteFlag=1 ORDER BY orderNum DESC")
	List<Map> queryActionAdvertisement();
	
	//查询AppUserTJ By devicesId and beginAt
	@SQL("select count(1) from AppUserTJ where devicesId=:1 AND beginAt<now() AND beginAt>date_sub(curdate(),interval 1 day) ")
	int queryTJSizeById(String devicesId);
	//添加统计记录
	@SQL("INSERT INTO AppUserTJ (devicesId,beginAt) VALUES (:1,now())")
	void createUserTJ(String devicesId);
	
	@SQL("select name from Lexicon where deleteFlag=1 ")
	List<Map> queryLexiconAll();
	
	//查询所以栏目
	@SQL("select id,columnsId,name,carouselImage,descs from Subject where deleteFlag=1 and id=:1 ")
	List<Map> querySubjectById(int id);
}
